Skip to content

Comments

Fix binding of texture()#7668

Merged
davepagurek merged 1 commit intodev-2.0from
fix/texture-binding
Mar 25, 2025
Merged

Fix binding of texture()#7668
davepagurek merged 1 commit intodev-2.0from
fix/texture-binding

Conversation

@davepagurek
Copy link
Contributor

Resolves #7665

Changes

Previously, we fixed a bug where a texture bound to a shader would unbind after its first use. So, textures stay bound. This lead to a scenario where if you draw using a framebuffer as a texture once:

texture(myFramebuffer)

...then if you later try to draw to that framebuffer, even without a texture applied, it would cause a feedback cycle since the framebuffer is still bound to the shader:

myFramebuffer.draw(() => {
  lights()
  circle(0, 0, 20) // Logs an error, doesn't draw anything in firefox
})

The problem is that we were using texture() to bind a texture, but when no texture is applied (e.g. after a pop()), we we're unbinding.

PR Checklist

@davepagurek davepagurek merged commit cf37090 into dev-2.0 Mar 25, 2025
2 checks passed
@davepagurek davepagurek deleted the fix/texture-binding branch March 25, 2025 12:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant